package org.dtrd.modules.tool.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.tool.entity.bean.ToolsDetail;


/**
 * <p>
 * 
 * </p>
 *
 * @author xiao
 * @since 2022-05-25
 */
@Getter
@Setter
@TableName("dtrd_ent_rd_tools")
public class DtrdEntRdTools {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 工具名称
     */
    @TableField("name")
    private String name;

    /**
     * 所属分类
     */
    @TableField("category_name")
    private String categoryName;

    /**
     * 图标
     */
    @TableField("icon")
    private String icon;

    /**
     * 相关知识-文本
     */
    @TableField("knowledge_text")
    private String knowledgeText;

    /**
     * 相关知识-图片
     */
    @TableField("knowledge_img")
    private String knowledgeImg;

    /**
     * 页面类型
     */
    @TableField("page_type")
    private Integer pageType;

    /**
     * 是否删除
     */
    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntRdTools init() {
        isDel = 0;
        return this;
    }

    public DtrdEntRdTools parseFromDto(ToolsDetail dto) {
        dataId = dto.getDataId();
        name = dto.getName();
        categoryName = dto.getCategoryName();
        icon = dto.getIcon();
        knowledgeText = dto.getKnowledgeText();
        knowledgeImg = dto.getKnowledgeImg();
        pageType = dto.getPageType();
        return this;
    }


}
